{include file='common/head'}
<div style="overflow-x: hidden;width: 96%;margin: auto;padding-top: 1rem;">
    <div class="layui-form" >
        <div class="layui-form-item">
            <input type="hidden" value="{$policy_num}" id="policy_num">
            <label class="layui-form-label">驳回模块</label>
            <div class="layui-input-inline">
                <select name="quiz1">
                    <option value="1" selected="">参与竞价</option>
                    <option value="2">看货信息</option>
                    <option value="3">提货信息</option>
                    <option value="4">收款信息</option>
                    <option value="5">递交委托书</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">驳回内容</label>
            <div class="layui-input-block">
                <textarea id="demo" style="display: none;" name="content" ></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit=""  lay-filter="demo1">立即提交</button>

            </div>
        </div>
    </div>
</div>
{include file='common/footer'}

<script>
    layui.use('layedit', function(){
        var layedit = layui.layedit;
        layedit.set({
            uploadImage: {
                url: '{:url("Upload/file_content")}' //接口url
                ,type: 'post' //默认post
            }
        });
        //注意：layedit.set 一定要放在 build 前面，否则配置全局接口将无效。
    });

</script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#start_time',
            type:'datetime'
        });
        laydate.render({
            elem: '#end_time',
            type:'datetime'
        });

        //创建一个编辑器
        var editIndex = layedit.build('demo');


        //自定义验证规则
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符';
                }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,
        });

        //监听指定开关
        form.on('switch(switchTest)', function(data){
            layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });

        //监听提交
        form.on('submit(demo1)', function(data){
            var content=layedit.getContent(editIndex);
            data.field['content']=content;
            $.ajax({
                url: '{:url("Pass/return_rem_msg")}',
                type: 'post',
                dataType: 'json',
                data: data.field,
                success: function (obj) {
                    if(obj.code==200){
                        parent.layer.msg(obj.msg);
                        //当你在iframe页面关闭自身时
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index,data.field); //再执行关闭
                    }
                    if(obj.code==400){
                        layer.msg(obj.msg, {icon: 5,time: 1000});
                    }
                },
                error:function(data){
                    console.log(data);
                },

            });

        });


    });
</script>

</body>
</html>